<script setup lang="ts">
import { ref } from 'vue'
import SonCom from './components/SonCom.vue'

const fName = ref('jack')
const fMoney = ref(10)

const sonCall = (moneyNum: number) => {
  console.log('子组件,触发了 change-money 事件')
  console.log(moneyNum)
  // 父组件接受传递过来的数据,并修改
  // 修改之后会重新传递给子组件
  fMoney.value = moneyNum
}
</script>

<template>
  <h2>我是父组件</h2>
  <SonCom :name="fName" :money="fMoney" @change-money="sonCall"></SonCom>
</template>

<style scoped></style>
